package com.gaber.polymorphic;

/**
 * @author gaber
 * @date 2023/7/11 15:55:12
 * @description TODO
 */
public class Salary extends Employee{

    private double salary;
    public Salary(String name, String address, int number, double salary) {
        super(name, address, number);
        setSalary(salary);
    }

    public void mailCheck() {
        System.out.println("Salary 类的 mailCheck 方法 ");
        System.out.println("邮寄支票给：" + getName()
                + " ，工资为：" + salary);
    }

    public double getSalary() {
        return salary;
    }

    public void setSalary(double newSalary) {
        if(newSalary > 0)
        this.salary = newSalary;
    }

    public double computePay() {
        System.out.println("计算工资，付给：" + getName());
        return salary/52;
    }
}
